package com.leetcode.array;

/**
 * 同125：双指针问题
 */
public class Leetcode344 {

    public void reverseString(char[] s) {
        if (s == null)
            return;
        int left = 0;
        int right = s.length - 1;
        while (left < right) {
            char tmp = s[left];
            s[left] = s[right];
            s[right] = tmp;
            left++;
            right--;
        }
    }

    public static void main(String[] args) {
        char[] s = {};
        Leetcode344 leet = new Leetcode344();
        leet.reverseString(s);
        for (int i = 0 ; i < s.length ; i++) {
            System.out.print(s[i] + " ");
        }
    }
}
